package com.teradata.olingo.processor.core.filter;

import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind;

import javax.persistence.criteria.Expression;

final class GenericUnaryBooleanOperatorImp implements GenericUnaryBooleanOperator {

  private final GenericOperationConverter converter;
  private final UnaryOperatorKind operator;
  private final GenericExpressionOperator left;

  public GenericUnaryBooleanOperatorImp(final GenericOperationConverter converter, final UnaryOperatorKind operator,
                                        final GenericExpressionOperator left) {
    super();
    this.converter = converter;
    this.operator = operator;
    this.left = left;
  }

  /*
   * (non-Javadoc)
   * 
   * @see GenericUnaryBooleanOperator#get()
   */
  @Override
  public Expression<Boolean> get() throws ODataApplicationException {
    return converter.convert(this);
  }

  /*
   * (non-Javadoc)
   * 
   * @see GenericUnaryBooleanOperator#getLeft()
   */
  @Override
  public Expression<Boolean> getLeft() throws ODataApplicationException {
    return left.get();
  }

  /*
   * (non-Javadoc)
   * 
   * @see GenericUnaryBooleanOperator#getOperator()
   */
  @Override
  public UnaryOperatorKind getOperator() {
    return operator;
  }

}
